<?php
/**
 * @since 17.12.2011
 * @author Akulov Denis
 */
class K_MVC_Model_Factory {

    /**
     * @var K_Container
     */
    private $_dbContainer = null;


    /**
     * @var K_Config
     */
    private $_config = null;


    /**
     * @var K_GlobalContext
     */
    private $_gc = null;


    /**
     * @param K_Config $objConfig
     */
    public function __construct(K_Config $config, K_GlobalContext $gc) {
        $this->_config = $config;
        $this->_gc = $gc;
        $this->_dbContainer = new K_Container();
    }


   /**
    * @param string $classModelName
    * @return K_MVC_Model_Base
    */
    public function factory ($classModelName, array $params = array()) {
        $classModelName = PREFIX_MODEL.$classModelName;

        return new $classModelName (
            $this,
            $params,
            $this->_config,
            $this->_dbContainer,
            $this->_gc
        );

    }
}